package com.imachen.ymcc.feign;

import com.imachen.ymcc.enums.GlobalExceptionCode;
import com.imachen.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;


@Component
public class UserFeignFallbackFactory implements FallbackFactory<UserFeign> {


    @Override
    public UserFeign create(Throwable throwable) {
        return new UserFeign() {
            @Override
            public JSONResult selectOne(Long id) {
                return JSONResult.error(GlobalExceptionCode.SERVICE_ERROR);
            }
        };
    }
}
